// HALCON/Qt pattern matching and measure example
//
// (c) 2004-2022 MVTec Software GmbH

// matching.h : Definition of the class Matching
//

#if QT_VERSION >= 0x050000
#  include <QtWidgets/qlabel.h>
#  include <QtWidgets/qpushbutton.h>
#else
#  include <qlabel.h>
#  include <qpushbutton.h>
#endif

#if defined (__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif

#include "qhalconwindow.h"

#include <filesystem>


class MainWindow : public QWidget
{
  Q_OBJECT

public:
  MainWindow(QWidget* parent = 0);
  virtual ~MainWindow(void);
  void actFirst();
  void actPre();
  void actNext();
  void actLast();
  void actGray(const QString& matchTime);

  void openImage();

protected:

	void	keyPressEvent(QKeyEvent* event) override;

private:
  // GUI elements
  QLabel *       lblGray;

  QLabel* lblImageNum;
  QLabel* lblImageName;

  QHalconWindow* qHalWin;



  QStringList offLineTestImageNameList;
  int imagesNum = 0;
  int nowIndex = -1;
  QString nowImageName;
  QString _loadImgDir;

  void loadImage(const QString& nowSelImagePath);

  void openImagePath(const QString& _imageDir, const QString& img = "");

  void loadTestImage(const QString& imagePath);
  void updateImageNumLabel();

};

